<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	include("_include.user.judge.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心</title>
<link rel="stylesheet" href="css/common.css"/>
<link rel="stylesheet" href="css/sq.css"/>
<script type="text/javascript" src="js/baidutongji.js"></script>
<script type="text/javascript" src="js/laydate/laydate.js"></script>
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <!--banner begin-->
    <? include("_include.user.topbar.php")?>
    <!--banner end-->
    <!--member center-->
    <div class="member-box">
        <div class="content">
			<? include("_include.user.leftnav.php") ?>
            <div class="member-box-r">
                <div class="member-item1">
                    <div class="m-title">更改手机号</div>
                    <?php include_once('_include.user.ordersearch.php');?>
                </div>
                <div class="member-basic">
				<form method="post" name="bindingphone" id="bindingphone" action="binding_phone_editaddsave.php?action=save" >
                    <div class="m-find-box">
                        <ul>
                           <!-- <li>
                                <span class="m-l">原手机号：</span>
                                <div class="m-r">
                                    <input type="text" class="m-find-input"/>
                                </div>
                            </li>-->
                            <li class="mt20">
                                <span class="m-l">手机号：</span>
                                <div class="m-r">
                                    <input type="text" class="m-find-input" name="user_phone" id="user_phone" />
                                    <span class="get-yzm">
    		                        	<a href="javascript:;" class="noyzm" >获取验证码</a>
    		                        	<a href="javascript:;" class="yesyzm" ><span>60</span>s后再获取</a>
    								</span>
                                    <div class="m-tips">我们将向该手机发送验证码，请在下方输入您收到的验证码</div>
                                </div>
                            </li>
                            <li>
                                <span class="m-l">验证码：</span>
                                <div class="m-r">
                                    <input type="text" name="user_phonecode" id="user_phonecode"  class="m-find-input"/>
                                </div>
                            </li>
                            <li class="mt30">
                                <span class="m-l"></span>
                                <div class="m-r">
								<input type="submit" value="绑定该手机" class="m-f-btn" name="m-f-btn" />
                                <a class="m-f-btn cancel" href="user_index.php">取消</a>
                                </div>
                            </li>
                        </ul>
                    </div>
				</form>
                </div>
            </div>
        </div>
    </div>
    <!--member center-->
    <!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
    <!--foot begin-->
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
    <script type="text/javascript" src="js/sq.js"></script>
    <script type="text/javascript" src="layer/layer.js"></script>
    <script type="text/javascript" src="js/alert.js"></script>
	<script language="javascript">
	$(document).ready(function(){
		// 表单提交
		$("#bindingphone").submit(function(){
			var user_phone = $("#user_phone").val();
			var user_phonecode = $("#user_phonecode").val();

			// 手机号验证
			if(user_phone == "" || !(/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/.test(user_phone))){
				alert("手机号格式错误！");
				$("#user_phone").focus();
				return false;
			}
			
			// 验证码验证
			if (user_phonecode.replace(/\ /g,"").length<1){
				alert("请正确输入验证码！");
				$("#user_phonecode").focus();
				return false;
			}
		});
		//电话号码截取
			$("input[name=user_phone]").keyup(function(){
				var str = $(this).val().slice(0,11);
				$(this).val(str);
			})
	});
	</script>
	<script type="text/javascript">
		$(".noyzm").click(function(){
			var phone = $("input[name=user_phone]").val();
			if(phone.replace(/\ /g,"").length<1){
				alert("手机不能为空！");
				return false;
			}
			$.ajax({
				type:"post",
				url:"/duanxin/fileTest.php",
				data:{phone:phone},
				dataType:"json",
				success:function(data){
					if(data == 1){
						var str = '<div class="award-box"><div class="award-hd"><div class="award-tips"><img src="../images/confirm.png" alt=""/></div><div class="award-notice">验证码我们已经通过短信形式发送到</br>您的手机号'+phone+'，请注意查收！</div><span class="rect"></span></div><span class="layui-layer-setwin"><a class="layui-layer-ico layui-layer-close layui-layer-close2" href="javascript:;"></a></span></div>';
						$("body").append(str);
						$(".layui-layer-close").on("click",function(){
							$(".award-box").remove();
						})
					}else if(data == 3){
						alert("手机不能为空");
					}else if(data == 2){
						alert("系统忙请重新发送");
					}else if(data == 4){
					    alert("该手机号违法违规发布游记，已被管理员拉黑");
					}
				}
			});
			$(this).hide();
			$(".yesyzm").show().css({"background":"#919191","cursor":"not-allowed"});
			t = setInterval(function(){
				var yes = $(".yesyzm span").html();
				var newyes = yes - 1 ;
				$(".yesyzm span").html(newyes);
				if(newyes == 0){
						clearInterval(t);
						$(".yesyzm span").html(60);
						$(".noyzm").show();
						$(".yesyzm").hide();
				}
			},1000)
		})
	</script>
</body>
</html>
